package com.atguigu.yygh.mq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author mgx
 * @version 1.0
 * @description: TODO
 * @date 2022/9/7 21:37
 */
@Service
public class RabbitService {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public boolean sendMessage(String exchange, String routeKey, Object message) {
        rabbitTemplate.convertAndSend(exchange, routeKey, message);
        return true;
    }
}
